java script converting text to slug

84

java script converting text to slug -

function convertToSlug(Text)
{
    return Text
        .toLowerCase()
        .replace(/ /g,'-')
        .replace(/[^\w-]+/g,'')
        ;
}

Comments

Submit
0 Comments